#ifndef LOGGER_H
#define LOGGER_H

#include <sstream>
#include <iostream>
#include <fstream>

#define LOG(level) \
if (level > Logger::ReportingLevel()) ; \
else Logger().Get(level)

// TODO: Fix the commenting in here
namespace Log
{
    static const int ERROR = 0;
    static const int WARNING = 1;
    static const int INFO = 2;
    static const int DEBUG = 3;
    static const int DEBUG1 = 4;
    static const int DEBUG2 = 5;
    static const int DEBUG3 = 6;
    static const int DEBUG4 = 7;
    static const int NUM_LEVELS = 8;
}

class Logger
{
public:
    Logger();
    virtual ~Logger();
    std::ostringstream& Get(int level = Log::INFO);
    static int& ReportingLevel();
    static void init(int repLevel = Log::INFO, std::string filename = "");
    static void shutdown();
protected:
    std::ostringstream os;
    int messageLevel;
    static std::ofstream* ofs;
    static int reportingLevel;
    static std::string levelNames[];
};

#endif
